package com.itheima_8;

import java.util.TreeSet;

public class TreeSetDemo01 {
    public static void main(String[] args) {
        TreeSet<Student> treeSet = new TreeSet<Student>();

        Student s1 = new Student("zhangsan",19);
        Student s2 = new Student("lisi",30);
        Student s3 = new Student("wangwu",20);
        Student s4 = new Student("liuliu",50);

        Student s5 = new Student("qiqi",50);
        Student s6 = new Student("qiqi",50);

        treeSet.add(s1);
        treeSet.add(s2);
        treeSet.add(s3);
        treeSet.add(s4);
        treeSet.add(s5);
        treeSet.add(s6);

        for (Student s : treeSet) {
            System.out.println(s.getName()+","+s.getAge());
        }
    }
}
